<?php
session_start();
header("Content-type:text/html;charset=utf-8");

include "../../lib/DB.php";
$db = new DB();

$user_name = isset($_SESSION['admin_name']) ? :"asd";
$consult = $_POST['liuyan'];
date_default_timezone_set('PRC');
$createtime = date("Y-m-d H:i:s");


$db->table('liuyan')->insert([
    'content' => $consult,
    'user_name' => $user_name,
    'createtime' => $createtime
]);

echo "<script>alert('添加成功');location='consult.php'</script>";
die;

?>